import React,{useState} from "react";
import { Button } from 'antd';
import './index.scss'
interface ISnakeHeader{
  array: number[][],
  changed: Function
}

const SnakeHeader:React.FC<ISnakeHeader> = (props, context) => {

  function clickChange1(){
    // console.log(props)
    const temp:number[][] = props.array
    for (let i = temp.length - 1; i >= 0; i--) {
      for (let j = 0; j < temp.length; j++) {
         if(i % 2 === 0 && j % 2 === 0){
            temp[i][j] = 2
         }
      }
    }
    props.changed(temp)
  }


  return <div className="snake-header">
    <Button onClick={clickChange1} type="primary" ghost>
      Changed One
    </Button>
    <Button type="dashed" ghost>
      Changed Two
    </Button>
  </div>
}

export default SnakeHeader;